const resetState = () => {
    return {
        userInfo: null,
        isLogin: true
    }
}
// 初始化数据
const state = resetState()

const actions = {
    setUserInfo({ commit }, userInfo) {
        commit('SET_USER_INFO', userInfo)
    }
}

const mutations = {
    RESET_STATE: (state) => {
        Object.assign(state, resetState())
    },
    SET_USER_INFO: (state, userInfo) => {
        state.userInfo = userInfo
    }
}

const getters = {
  welcome: state => state.userInfo
}

export default {
    namespaced: true, // 设置独立命名空间，避免命名冲突
    state,
    mutations,
    getters,
    actions
}
  